package com.littleant.customer.service.impl;

import com.littleant.common.utils.DateUtils;
import com.littleant.customer.domain.CrmCustomerInfo;
import com.littleant.customer.mapper.CrmCustomerInfoMapper;
import com.littleant.customer.service.ICrmCustomerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 客户信息管理Service业务层处理
 * 
 * @author littleant
 * @date 2022-03-15
 */
@Service
public class CrmCustomerInfoServiceImpl implements ICrmCustomerInfoService
{
    @Autowired
    private CrmCustomerInfoMapper crmCustomerInfoMapper;

    /**
     * 查询客户信息管理
     * 
     * @param customerId 客户信息管理主键
     * @return 客户信息管理
     */
    @Override
    public CrmCustomerInfo selectCrmCustomerInfoByCustomerId(Long customerId)
    {
        return crmCustomerInfoMapper.selectCrmCustomerInfoByCustomerId(customerId);
    }

    /**
     * 查询客户信息管理列表
     * 
     * @param crmCustomerInfo 客户信息管理
     * @return 客户信息管理
     */
    @Override
    public List<CrmCustomerInfo> selectCrmCustomerInfoList(CrmCustomerInfo crmCustomerInfo)
    {
        return crmCustomerInfoMapper.selectCrmCustomerInfoList(crmCustomerInfo);
    }

    /**
     * 新增客户信息管理
     * 
     * @param crmCustomerInfo 客户信息管理
     * @return 结果
     */
    @Override
    public int insertCrmCustomerInfo(CrmCustomerInfo crmCustomerInfo)
    {
        crmCustomerInfo.setCreateTime(DateUtils.getNowDate());
        return crmCustomerInfoMapper.insertCrmCustomerInfo(crmCustomerInfo);
    }

    /**
     * 修改客户信息管理
     * 
     * @param crmCustomerInfo 客户信息管理
     * @return 结果
     */
    @Override
    public int updateCrmCustomerInfo(CrmCustomerInfo crmCustomerInfo)
    {
        crmCustomerInfo.setUpdateTime(DateUtils.getNowDate());
        return crmCustomerInfoMapper.updateCrmCustomerInfo(crmCustomerInfo);
    }

    /**
     * 批量删除客户信息管理
     * 
     * @param customerIds 需要删除的客户信息管理主键
     * @return 结果
     */
    @Override
    public int deleteCrmCustomerInfoByCustomerIds(Long[] customerIds)
    {
        return crmCustomerInfoMapper.deleteCrmCustomerInfoByCustomerIds(customerIds);
    }

    /**
     * 删除客户信息管理信息
     * 
     * @param customerId 客户信息管理主键
     * @return 结果
     */
    @Override
    public int deleteCrmCustomerInfoByCustomerId(Long customerId)
    {
        return crmCustomerInfoMapper.deleteCrmCustomerInfoByCustomerId(customerId);
    }
}
